package rescue;

import java.io.FileInputStream;
import java.io.InputStream;
import javax.vecmath.*;
import simbad.gui.Simbad;


public class Main
{
    public static void main(String args[])
    {
	MyRescueRobot robot;
	double timeLimit =1200.0;
	double noiseLevel=1.0;
	int i;
        // request antialising
        System.setProperty("j3d.implicitAntialiasing", "true");

        String inFileName = null;

	for( i=0; i < args.length; i++ ) {
	    if( args[i].equals("-n")) {
		if( i < args.length ) {
		    i++;
		    noiseLevel = Double.parseDouble(args[i]);
		}
	    }
	    else if( args[i].equals("-t")) {
		if( i < args.length ) {
		    i++;
		    timeLimit = Double.parseDouble(args[i]);
		}
	    }
	    else {
		inFileName = args[i];
	    }
	}

	robot = new MyRescueRobot(new Vector3d(0,0,0), 1, "R1");
	robot.setTimeLimit(timeLimit);
	robot.setNoiseLevel(noiseLevel);

        // Create a new disaster zone, passing the robot
        DisasterZone arena = new DisasterZone(robot,inFileName);

        // create Simbad instance with given environment
        Simbad sim = new Simbad(arena, false);

        // Start the simulation running at the given speed
        sim.start(5.0f);
    }
}
